﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace URSA.Classes
{
    public class AcceloMeter
    {
        public AcceloMeter(double aOffset, double aRange, double bOffset, double bRange, double cOffset, double cRange)
        {
            channelA = new AcceloChannel(aOffset, aRange);
            channelB = new AcceloChannel(bOffset, bRange);
            channelC = new AcceloChannel(cOffset, cRange);
        }

        ~AcceloMeter()
        {
            channelA = null;
            channelB = null;
            channelC = null;
        }

        public void calcAngles()
        {
            anglePitch = Math.Asin((channelB.reading - channelB.rtnOff()) / channelB.rtnRan());
            angleRoll = Math.Asin((channelC.reading - channelC.rtnOff()) / channelC.rtnRan());
        }

        private AcceloChannel channelA;
        private AcceloChannel channelB;
        private AcceloChannel channelC;

        public double anglePitch;
        public double angleRoll;
    }
}
